define(['app'], function(app) {
	'use strict';

	// 实例化方法
	var factory = function(Http) {

	    function get_data_statistics(result){
	        if(HTTP_ISLOGIC){
	            result='{"success":true,"msg":"","result":{"name":"促销","total_attention_num":100,"total_apply_num":100,"total_agree_num":100,"total_pay_num":100,"total_answer_num":100,"attention_num":[{"region_id":"001","region_name":"江苏","number":100},{"region_id":"002","region_name":"浙江","number":100}],"apply_num":[{"region_id":"001","region_name":"江苏","number":100},{"region_id":"002","region_name":"浙江","number":100}],"agree_num":[{"region_id":"001","region_name":"江苏","number":100},{"region_id":"002","region_name":"浙江","number":100}],"pay_num":[{"region_id":"001","region_name":"江苏","number":100},{"region_id":"002","region_name":"浙江","number":100}],"answer_num":[{"region_id":"001","region_name":"江苏","number":100},{"region_id":"002","region_name":"浙江","number":100}]},"session":"7311da98bd0f18eb15a96bcb263f4153"}';
	            return JSON.parse(result);
	        }else{
	            return result;
	        }
	    };

			return {

			get_statistics:function(act_id,act_type,callback){
                Http.post({
                    method:'marketing.newgoods.statistics',
                    act_id:act_id,
                    act_type:act_type
                },function(result) {
                        //请求成功
                        if(callback)
                            callback(get_data_statistics(result).result);
                },
                  function(e) {
                        //请求异常
                },
                  function() {
                        //请求完成，一般不做什么事情
                    });

			},



			//获取首页数据
			get_rights: function(callback) {
				//post请求
				Http.post('home', {}, function(result) {
					//函数回调
					if(callback)
						callback(result);
				});


			}
		};
	}

	factory.$inject = [ 'Http' ];
	return app.registerService("Statistics_present", factory);
});